<div id="left_side">
	<!--Header-->
	<div id="video_play_header">
		<h1>
			<?php if($dataResult->video_type_id == 1):?>
				<a title="add to playlist" class="_playlist" target="_blank" href="<?php echo $playlist_url.'video/'.$dataResult->video_id.'-'.seo_url($dataResult->video_name);?>"></a>
			<?php endif;?>
			<?php echo $dataResult->video_name;?>
		</h1>
		<h2>
			<?php foreach($dataResult->artist as  $value):?>
			<?php echo $value['artist_name'].' ';?>
			<?php endforeach;?>
		</h2>
		<a href="<?php echo $playlist_url.'video/'.$dataResult->video_id.'-'.seo_url($dataResult->video_name);?>" target="_blank" class="_playlist _text"title="add to playlist"></a>		
	</div>
	<!--Video Play Content-->
	<div id="video_play_order2">
	<div id="video_play_content">
		<!--Video Lyrics-->
<!--		<div id="video_play_lyrics">
			<h2>เนื้อเพลง <?php //echo $dataResult->video_name;?></h2>
			<p>
				<?php //if(!empty($dataResult->lyrics)):?>
					<?php //foreach($dataResult->lyrics as $value):?>
						<?php //echo $value->song_lyrics;?>
					<?php //endforeach;?>
				<?php //else:?>
					ไม่พบ เนื้อเพลง ของ <?php //echo $dataResult->video_name;?>
				<?php //endif;?>
			</p>
		</div>-->	
		<!--Video Description-->
		<div id="video_play_description">
			<div class="leftSide">
				<div class="image">
					<?php echo exec_image(array(
							'folder' => 'video',
							'dimension' => '160x160',
							'file_name' => @$dataResult->video_thumb_name.'.'.@$dataResult->video_thumb_ext,
							'alt' => ''.@$dataResult->video_name.'',	
							'title' => ''.@$dataResult->video_name.''	
						)
					);?>
				</div>
				<div class="vote">
					<a href="javascript:void(0);" onclick="javascript:voteVideo(this,<?php echo $dataResult->video_id;?>,1);" class="star <?php echo (floor($dataResult->rate_score) >= 1 ? 'active':'');?>"></a>	
					<a href="javascript:void(0);" onclick="javascript:voteVideo(this,<?php echo $dataResult->video_id;?>,2);" class="star <?php echo (floor($dataResult->rate_score) >= 2 ? 'active':'');?>"></a>	
					<a href="javascript:void(0);" onclick="javascript:voteVideo(this,<?php echo $dataResult->video_id;?>,3);" class="star <?php echo (floor($dataResult->rate_score) >= 3 ? 'active':'');?>"></a>	
					<a href="javascript:void(0);" onclick="javascript:voteVideo(this,<?php echo $dataResult->video_id;?>,4);" class="star <?php echo (floor($dataResult->rate_score) >= 4 ? 'active':'');?>"></a>	
					<a href="javascript:void(0);" onclick="javascript:voteVideo(this,<?php echo $dataResult->video_id;?>,5);" class="star <?php echo (floor($dataResult->rate_score) >= 5 ? 'active':'');?>"></a>	
					<div>ผลโหวต <span class="voteAvg"><?php echo $dataResult->rate_score;?></span> จาก <span class="votePeople"><?php echo number_format($dataResult->video_rate_all);?></span> คน</div>					
				</div>
			</div>
			<div class="rightSide">
				<h2><?php echo $dataResult->video_name;?></h2>
				<!--Artist-->
				<?php if(!empty($dataResult->artist)):?>
				<h4>
					ศิลปิน : 
					<?php foreach($dataResult->artist as $value):?>
						 <a href="<?php echo $artist_url.'summary/'.$value['artist_id'].'-'.seo_url($value['artist_name']);?>" target="_blank"><?php echo $value['artist_name'];?></a>&nbsp;
					<?php endforeach;?>
				</h4>
				<?php endif;?>
				<!--Album-->
				<?php if(!empty($dataResult->artist) && !empty($dataResult->album)):?>				
				<h4>
					อัลบั้ม : 
					<?php foreach($dataResult->album as $value):?>
						<a href="<?php echo $artist_url.'album/'.$dataResult->artist[0]['artist_id'].'-'.seo_url($dataResult->artist[0]['artist_name']).'/'.$value['album_id'].'-'.seo_url($value['album_name']);?>" target="_blank"><?php echo $value['album_name'];?></a>&nbsp;
					<?php endforeach;?>
				</h4>
				<?php endif;?>
				<!--Genre-->
				<?php if(!empty($dataResult->genre_name)):?>
				<h4>ประเภท : <?php echo $dataResult->genre_name;?></h4>
				<?php endif;?>
				<p>
					<?php echo $dataResult->video_description;?>
				</p>
			</div>
			<?php if($dataResult->is_relate_song == 1):?>
			<div class="clear"></div>
			<hr />
			<h2>เนื้อเพลง <?php echo $dataResult->video_name;?></h2>
			<p>
				<?php if(!empty($dataResult->lyrics)):?>
					<?php foreach($dataResult->lyrics as $value):?>
						<?php echo $value->song_lyrics."<br />";?>
					<?php endforeach;?>
				<?php else:?>
					ไม่พบ เนื้อเพลง ของ <?php echo $dataResult->video_name;?>
				<?php endif;?>
			</p>
			<?php endif;?>
		</div>
		<!--Video Chords-->
		<div id="video_play_chords">
			<h2>คอร์ดเพลง <?php echo $dataResult->video_name;?></h2>
			<p>
				<?php if(!empty($dataResult->video_chords)):?>
					<?php echo $dataResult->video_chords;?>
				<?php else:?>
					ไม่พบ คอร์ดเพลง ของ <?php echo $dataResult->video_name;?>
				<?php endif;?>
			</p>
		</div>
		<!--Video Share-->
		<div id="video_play_share">
			<input type="text" value="<?php echo $video_url.'play/'.$dataResult->video_id;?>" id="page_url" name="page_url" readonly="true">
			<a href="javascript:void(0);" id="copy_page_url" onmouseOver="toClipboard(this)"><?php echo image_asset('video/copy_url.jpg','',array('width' => 73,'height' => 19));?></a><br />
			<?php if(empty($dataResult->video_embed)):?>
				<input type="text" value="&lt;iframe width=&quot;640&quot; height=&quot;382&quot; src=&quot;//www.you2play.com/player/video/<?php echo $dataResult->video_id;?>&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; allowtransparency=&quot;true&quot;&gt;&lt;/iframe&gt;" id="page_embed" name="page_embed" readonly="true">
				<!--<input type="text" value="&lt;embed src=&quot;<?php echo js_asset_url('media/player.swf');?>&quot; flashvars=&quot;file=<?php echo other_asset_url('uploads/video/files/'.date('Y/m/d',strtotime($dataResult->create_date)).'/'.$dataResult->video_file_name.'.'.$dataResult->video_file_ext);?>&amp;image=<?php echo other_asset_url('uploads/video/images/original/'.@$dataResult->video_thumb_name.'.'.@$dataResult->video_thumb_ext);?>&amp;autostart=false&amp;stretching=exactfit&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;386&quot; /&gt;" id="page_embed" name="page_embed" readonly="true">-->
				<a href="javascript:void(0);" id="copy_page_embed" onmouseOver="toClipboard(this)"><?php echo image_asset('video/copy_embed.jpg','',array('width' => 73,'height' => 19));?></a><br />
			<?php endif;?>
		</div>				
	</div>
	<!--Comment-->
	<div id="video_play_comment">
		<h2>
			<span>แสดงความคิดเห็น</span>
		</h2>
		<!--Facebook Comment-->
		<?php echo $module_facebook_plugins_comment;?>
	</div>
	</div>	
	<div id="video_play_order1">
	<!--Video Player-->
	<div id="video_play_bg">
		<script type='text/javascript'>
		<!--// <![CDATA[
		var OA_zones = {
			'ads_top' : 131,
			'ads_bottom' : 128
		}
		// ]]> -->
		</script>
		<script type='text/javascript' src='http://ads.you2play.com/openx/delivery/spcjs.php'></script>		
		<div id="video_play_ads_top">
			<script type='text/javascript'>
			<!--// <![CDATA[
				OA_show('ads_top');
			// ]]> -->
			</script>				
		</div>
		<div id="video_play_object">
			<?php if(!empty($dataResult->video_embed) && $this->agent->is_mobile()):?>
				<?php echo $dataResult->video_embed;?>
			<?php else:?>
				<!--Vdo Player-->
				<div id="vdoPlayer">
					<?php if($this->agent->is_mobile()):?>
						<video id='my_video' controls preload='none'></video>
					<?php endif;?>
				</div>
			<?php endif;?>
		</div>
		<div id="video_play_ads_bottom">
			<script type='text/javascript'>
			<!--// <![CDATA[
				OA_show('ads_bottom');
			// ]]> -->
			</script>		
		</div>
	</div>
	<!--Video Relate-->
	<div id="video_play_relate">
		<?php if(!empty($dataVideoRelate)):?>
		<div class="cycleElementsContainer" id="slider">
			<a href="#" id="cycle-prev"></a>
			<div>
			<ul>
				<?php foreach($dataVideoRelate as $key => $value):?>
				<li>
					<a href="<?php echo base_url().'play/'.end(explode('_',$value->id)).'-'.seo_url($value->video_name_s);?>" target="_self">
						<div class="image">
							<?php echo exec_image(array(
									'folder' => 'video',
									'dimension' => '60x60',
									'file_name' => @$value->video_image_name_s,
									'alt' => ''.@$value->video_name_s.'',	
									'title' => ''.@$value->video_name_s.''	
								)
							);?>
						</div>	
					</a>
					<a href="<?php echo base_url().'play/'.end(explode('_',$value->id)).'-'.seo_url($value->video_name_s);?>" target="_self"><h3><?php echo $value->video_name_s;?></h3></a>
					<p>
						<?php if(!empty($value->artist)) foreach($value->artist as $artist):?>
							<?php echo $artist->artist_name_s;?>
						<?php endforeach;?>
					</p>			
				</li>
				<?php endforeach;?>
			</ul>
			</div>
			<a href="#" id="cycle-next"></a>
		</div>
		<?php endif;?>
		<div id="video_play_menu">
			<ul>
				<li>
					<a href="javascript:void(0);" class="active" onclick="javascript:goTab('#video_play_description',this);">รายละเอียด</a>
				</li>
<!--				<li>
					<a href="javascript:void(0);" onclick="javascript:goTab('#video_play_lyrics',this);">เนื้อเพลง</a>
				</li>-->
				<li>
					<a href="javascript:void(0);" onclick="javascript:goTab('#video_play_share',this);">แชร์</a>
				</li>
				<?php if(!empty($dataResult->chords) && !empty($dataResult->chords->chords_id)):?>
				<li>
					<a href="<?php echo $chord_url.'play/'.$dataResult->chords->chords_id.'-'.seo_url($dataResult->chords->song_name);?>" target="_blank">คอร์ด/แทป</a>
				</li>
				<?php endif;?>			
			</ul>
			<span>
				ฟัง <?php echo number_format($dataResult->views);?> ครั้ง
			</span>
		</div>
	</div>
	<!--Facebook Plugin-->
	<?php echo $module_facebook_plugins_share;?>
	</div>
</div>
<div id="right_side">
	<!--Module-->
	<?php
	if(!empty($module))
	foreach($module as $value):?>
	<?php echo $value;?>
	<?php endforeach;?>
</div>
<script type="text/javascript" language="javascript">
(function($) {
/*whatever jQuery stuff*/
	$(function(){
		//multipleElementsCycle
		$("#slider").multipleElementsCycle({
			scrollCount: 3,
			start: 0
		});	
		
		//Countdown to keep stats 10 seconds
		setTimeout(function(){
			$.ajax({
				type:'post',
				url: web_path+'ajax_view_video',
				data:({
					id:'<?php echo $dataResult->video_id;?>'	
				})
			});
		},10000);				
	});	
})(jQuery);
	/*ZeroClipboard*/
	function toClipboard(e)
	{
		ZeroClipboard.setMoviePath("<?php echo base_url().'ZeroClipboard.swf';?>");
		var clip = new ZeroClipboard.Client();
	    clip.setHandCursor( true );		
		var id_copy = '#'+$(e).attr('id').replace('copy_','');	
		var id = $(e).attr('id');	
		copything = $(''+id_copy+'').val();
		clip.setText(copything);
		if (clip.div)
		{
			clip.receiveEvent('mouseout', null);
			clip.reposition(id);
		}
		else
		{
			clip.glue(id);
		}

		clip.receiveEvent('mouseover', null);
		//When User Copy Link
		clip.addEventListener('complete', function (client, text) {
			$.ajax({
				type:'post',
				url:web_path+'ajax_copy_stat',
				data:({
					video_id:'<?php echo $dataResult->video_id;?>'
				})	
			}).done(function(data){
				alert('คัดลอกข้องมูลลง Clipboard เรียบร้อย');
			});
		});
	}
</script>	
<?php if(empty($dataResult->video_embed)): //if no embed load jwplayer?>
<!-- Hawkeye : The First Script is PreQual -->
<script type="text/javascript" language="JavaScript">
	//name: You2Play (Direct_Thailand) PreRoll 
	//created: 09/26/2013 16:51
										
	var cb = new Date().getTime();							
	var asiPqTag = false;							
	try { 								
		document.write("<sc" + "ript type='text/javascript' language='JavaScript' src='//pq-direct.revsci.net/pql?placementIdList=0qHox8&cb=" + cb + "'></sc" + "ript>");						
	} catch(err) { }						
</script>
<!-- Hawkeye: Ending The First Script -->	
<!-- Hawkeye : The second script is PASIT code for Videoplaza -->
<script type="text/javascript">
	if (typeof asiPlacements != "undefined") {
		var gwdTagData = 'adgroup=' + asiPlacements['0qHox8'].default.key + '&blob=' + asiPlacements['0qHox8'].blob;
		if ('0qHox8' in asiPlacements) {
			var gwdTagData = 'adgroup=' + asiPlacements['0qHox8'].default.key + '&blob=' + asiPlacements['0qHox8'].blob;
		}
		for(var p in asiPlacements) {
			if(asiPlacements[p].default&&asiPlacements[p].default.key){ window["ASPQ_"+p]="PQ_"+p; }
		}
	}
</script>
<!--  Hawkeye: Ending The Second Script -->	
<script type="text/javascript" language="javascript">
(function($) {
/*whatever jQuery stuff*/
	$(function(){
		var is_mobile = '<?php echo $this->agent->is_mobile();?>';
		//var url = "<?php echo other_asset_url('uploads/video/files/'.date('Y/m/d',strtotime($dataResult->create_date)).'/'.$dataResult->video_file_name.'.'.$dataResult->video_file_ext);?>";
		var url = "http://vstatic.you2play.com/2013/assets/<?php echo 'uploads/video/files/'.date('Y/m/d',strtotime($dataResult->create_date)).'/'.$dataResult->video_file_name.'.'.$dataResult->video_file_ext;?>";
		if(is_mobile){
			//Set Video Source
			$('#my_video').append("<source id='mp4' src='"+url+"' type='video/mp4'>");
			$('#my_video').attr('src',""+url+"");
			$('#my_video').attr('width',640);
			$('#my_video').attr('height',382);
			// videoplaza sdk, 4 sec time-out, callback function
			//loadScript("<?php //echo js_asset_url('media/html5-sdk-1.0.12.15.1-ea.min.js');?>",4000,initVideoplaza);
			// *** START - videoplaza plugin config ***
/*			vpConfig = {
				vphost : 'http://th-pmdplus.videoplaza.tv',
				category : 'video',
				//tags : ['standard'],
				tags : [myDynamicTag()],
				contentId : mygwdTagData(),
				flags: [],
				playbackPosition: [] // mid-roll cue points, if any.
			}*/
			// *** END - videoplaza plugin config ***
			//Auto Play && Loop
			$('#my_video').attr('autoplay','autoplay');	
		} else {
			var playlist = [{file:""+url+""}];
/*			jwplayer('vdoPlayer').setup({
			  "autostart": true,
			  "flashplayer": "<?php //echo js_asset_url('media/player.swf');?>",
			  "playlist": playlist,
			  "width": 640,
			  "height": 382,
			  //"stretching": "exactfit",
			  "controlbar": {
			    "position": "bottom"
			  },
			  "plugins": {
			    "ova-jw": {
				  "canFireEventAPICalls": true,
			      "ads": {
			        "skipAd": {
			          "enabled": "true"
			        },
			        "schedule": [
			          {
			            "position": "pre-roll",
			            "tag": ""+generatTag('<?php //echo json_encode($dataAds);?>')+""
			          },
					  {
					  	"position": "post-roll",
						"tag": "http://ads.you2play.com/openx/delivery/fc.php?script=bannerTypeHtml:vastInlineBannerTypeHtml:vastInlineHtml&source=&format=vast&charset=UTF_8&nz=1&zones=z1=166"
					  }   
			        ]
			      }
			    }
			  },
              "provider": "http",
          	  "startparam": "starttime"	
			});	*/
			jwplayer("vdoPlayer").setup({
				"autostart": true,
		      	"flashplayer": "<?php echo js_asset_url('media/player.swf');?>",
				"playlist": playlist,
		      	"width": 640,
		      	"height": 382,
		      	"plugins": "<?php echo js_asset_url('media/vp_plugin.swf');?>",
		      	"vpdomain": "http://th-pmdplus.videoplaza.tv",
		      	"vpshares": "video",
		      	"vptags": myDynamicTag(),
			  	"vpContentid": mygwdTagData(),
				"closebuttontimeout": 5,
				"vptimeout": 15000,
               	"provider": "http",
        		"startparam": "starttime"	
			});	
		}
		
		/*Create Read more Button*/
		var lyric_height_limit = 350;
		var lyric_height = $('#video_play_description').height();
		var is_more_lyric = (lyric_height > lyric_height_limit ? true:false);
		if(is_more_lyric){
			$('#video_play_description').css('height', lyric_height_limit); /*Set Height*/
			/*Add More Button*/
			$('#video_play_content').after('<div id="lyric_toggle"><div>แสดงเพิ่มเติม&nbsp;<span class="arrowUp"><\/span><\/div><\/div>');
						
			/*Add Action Script*/
			$('#lyric_toggle').click(function(){
				if($('#video_play_description').css('height') == lyric_height+'px') {
					$('#video_play_description').css('height', lyric_height_limit);
					$('#lyric_toggle div').html('แสดงเพิ่มเติม&nbsp;<span class="arrowUp"><\/span>');
					$('html, body').animate({scrollTop: $(this).offset().top - lyric_height_limit}, "fast");
				} else {
					$('#video_play_description').css('height', lyric_height);
					$('#lyric_toggle div').html('ซ่อนเนื้อเพลง&nbsp;<span class="arrowDown"><\/span>');	
				}
				event.preventDefault();
			});
		}		
	});	
})(jQuery);
</script>
<?php elseif(!(empty($dataResult->video_embed) && $this->agent->is_mobile())):?>
<!-- Hawkeye : The First Script is PreQual -->
<script type="text/javascript" language="JavaScript">
	//name: You2Play (Direct_Thailand) PreRoll 
	//created: 09/26/2013 16:51							
	var cb = new Date().getTime();							
	var asiPqTag = false;							
	try { 								
		document.write("<sc" + "ript type='text/javascript' language='JavaScript' src='//pq-direct.revsci.net/pql?placementIdList=0qHox8&cb=" + cb + "'></sc" + "ript>");						
	} catch(err) { }						
</script>
<!-- Hawkeye: Ending The First Script -->	
<!-- Hawkeye : The second script is PASIT code for Videoplaza -->
<script type="text/javascript">
	if (typeof asiPlacements != "undefined") {
		var gwdTagData = 'adgroup=' + asiPlacements['0qHox8'].default.key + '&blob=' + asiPlacements['0qHox8'].blob;
		if ('0qHox8' in asiPlacements) {
			var gwdTagData = 'adgroup=' + asiPlacements['0qHox8'].default.key + '&blob=' + asiPlacements['0qHox8'].blob;
		}
		for(var p in asiPlacements) {
			if(asiPlacements[p].default&&asiPlacements[p].default.key){ window["ASPQ_"+p]="PQ_"+p; }
		}
	}
</script>
<!--  Hawkeye: Ending The Second Script -->	
<script type="text/javascript" language="javascript">
(function($) {
/*whatever jQuery stuff*/
	$(function(){
			var video_embed = "<?php echo addslashes($dataResult->video_embed);?>";
			var url = 'http://www.youtube.com/watch?v='+video_embed.match(/embed\/(.+?)[^a-zA-Z0-9-_]/)[1].split('\?')[0];
			var playlist = [{file:""+url+""}];
			jwplayer("vdoPlayer").setup({
				"autostart": true,
		      	"flashplayer": "<?php echo js_asset_url('media/player.swf');?>",
				"playlist": playlist,
		      	"width": 640,
		      	"height": 382,
		      	"plugins": "<?php echo js_asset_url('media/vp_plugin.swf');?>",
		      	"vpdomain": "http://th-pmdplus.videoplaza.tv",
		      	"vpshares": "video",
		      	"vptags": myDynamicTag(),
			  	"vpContentid": mygwdTagData(),
				"closebuttontimeout": 15,
				"vptimeout": 15000,
               	"provider": "http",
        		"startparam": "starttime"				
			});	
	});	
})(jQuery);	
</script>		
<?php endif;?>